package demo.lifecycle;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * @author created by wangyang
 * email:techyang.wangy@ymm56.com
 * company: yunmanman
 * @date 2018/8/27 下午3:19
 */
public class MyPostConstruct implements InitializingBean, DisposableBean {
    private static final Logger LOGGER = LoggerFactory.getLogger(MyPostConstruct.class);

    @PostConstruct
    public void postConstruct() {
        LOGGER.info("@PostConstruct");
    }

    @PreDestroy
    public void preDestroy() {
        LOGGER.info("@PreDestroy");
    }

    @Override
    public void destroy() throws Exception {
        LOGGER.info("DisposableBean");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        LOGGER.info("InitializingBean");
    }
}

